<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="技术特征台账主键" prop="techFeaturesId">
        <el-input
          v-model="queryParams.techFeaturesId"
          placeholder="请输入技术特征台账主键"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="设备编码" prop="equipmentCode">
        <el-input
          v-model="queryParams.equipmentCode"
          placeholder="请输入设备编码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="设备名称" prop="equipmentName">
        <el-input
          v-model="queryParams.equipmentName"
          placeholder="请输入设备名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="设备类型字典ID" prop="equipmentTypeId">
        <el-input
          v-model="queryParams.equipmentTypeId"
          placeholder="请输入设备类型字典ID"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="设备类型字典名称" prop="equipmentTypeName">
        <el-input
          v-model="queryParams.equipmentTypeName"
          placeholder="请输入设备类型字典名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="分类主键" prop="classifyId">
        <el-input
          v-model="queryParams.classifyId"
          placeholder="请输入分类主键"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="分类编码" prop="classifyCode">
        <el-input
          v-model="queryParams.classifyCode"
          placeholder="请输入分类编码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="分类名称" prop="classifyName">
        <el-input
          v-model="queryParams.classifyName"
          placeholder="请输入分类名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="设备别名" prop="equipmentAlias">
        <el-input
          v-model="queryParams.equipmentAlias"
          placeholder="请输入设备别名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="所在系统树名称id" prop="eqSysId">
        <el-input
          v-model="queryParams.eqSysId"
          placeholder="请输入所在系统树名称id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="所在系统树名称" prop="eqSysName">
        <el-input
          v-model="queryParams.eqSysName"
          placeholder="请输入所在系统树名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="设备规格" prop="specs">
        <el-input
          v-model="queryParams.specs"
          placeholder="请输入设备规格"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="设备型号" prop="model">
        <el-input
          v-model="queryParams.model"
          placeholder="请输入设备型号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="制造厂家" prop="manufacturer">
        <el-input
          v-model="queryParams.manufacturer"
          placeholder="请输入制造厂家"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="出厂年月" prop="factDate">
        <el-date-picker clearable
          v-model="queryParams.factDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择出厂年月">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="出厂编号" prop="factCode">
        <el-input
          v-model="queryParams.factCode"
          placeholder="请输入出厂编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="供应商" prop="supplier">
        <el-input
          v-model="queryParams.supplier"
          placeholder="请输入供应商"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="交货日期" prop="wareAt">
        <el-date-picker clearable
          v-model="queryParams.wareAt"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择交货日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="投产日期" prop="putProductAt">
        <el-date-picker clearable
          v-model="queryParams.putProductAt"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择投产日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="维护单位id" prop="maintainDeptId">
        <el-input
          v-model="queryParams.maintainDeptId"
          placeholder="请输入维护单位id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="维护单位名称" prop="maintainDeptName">
        <el-input
          v-model="queryParams.maintainDeptName"
          placeholder="请输入维护单位名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="保修开始" prop="guaranteeStart">
        <el-date-picker clearable
          v-model="queryParams.guaranteeStart"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择保修开始">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="保修结束" prop="guaranteeEnd">
        <el-date-picker clearable
          v-model="queryParams.guaranteeEnd"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择保修结束">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="使用状态字典ID" prop="useStatusId">
        <el-input
          v-model="queryParams.useStatusId"
          placeholder="请输入使用状态字典ID"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="使用状态字典名称" prop="useStatusName">
        <el-input
          v-model="queryParams.useStatusName"
          placeholder="请输入使用状态字典名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="设备状态字典id" prop="equipmentStatusId">
        <el-input
          v-model="queryParams.equipmentStatusId"
          placeholder="请输入设备状态字典id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="设备状态字典名称" prop="equipmentStatusName">
        <el-input
          v-model="queryParams.equipmentStatusName"
          placeholder="请输入设备状态字典名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="运行状态字典id" prop="runStatusId">
        <el-input
          v-model="queryParams.runStatusId"
          placeholder="请输入运行状态字典id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="运行状态字典名称" prop="runStatusName">
        <el-input
          v-model="queryParams.runStatusName"
          placeholder="请输入运行状态字典名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="放置地点id" prop="positionAddressId">
        <el-input
          v-model="queryParams.positionAddressId"
          placeholder="请输入放置地点id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="放置地点" prop="positionAddress">
        <el-input
          v-model="queryParams.positionAddress"
          placeholder="请输入放置地点"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="" prop="manageCode">
        <el-input
          v-model="queryParams.manageCode"
          placeholder="请输入"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="资产编码" prop="assetCode">
        <el-input
          v-model="queryParams.assetCode"
          placeholder="请输入资产编码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物资编码" prop="materialCode">
        <el-input
          v-model="queryParams.materialCode"
          placeholder="请输入物资编码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="是否可用 默认1" prop="enable">
        <el-input
          v-model="queryParams.enable"
          placeholder="请输入是否可用 默认1"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="创建人" prop="createByName">
        <el-input
          v-model="queryParams.createByName"
          placeholder="请输入创建人"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="创建时间" prop="createAt">
        <el-date-picker clearable
          v-model="queryParams.createAt"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择创建时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="更新人" prop="updateByName">
        <el-input
          v-model="queryParams.updateByName"
          placeholder="请输入更新人"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="更新时间" prop="updateAt">
        <el-date-picker clearable
          v-model="queryParams.updateAt"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择更新时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="排序" prop="sorting">
        <el-input
          v-model="queryParams.sorting"
          placeholder="请输入排序"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="版本" prop="version">
        <el-input
          v-model="queryParams.version"
          placeholder="请输入版本"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="参照物" prop="extra1">
        <el-input
          v-model="queryParams.extra1"
          placeholder="请输入参照物"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="距离" prop="extra2">
        <el-input
          v-model="queryParams.extra2"
          placeholder="请输入距离"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="扩展字段3" prop="extra3">
        <el-input
          v-model="queryParams.extra3"
          placeholder="请输入扩展字段3"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="扩展字段4" prop="extra4">
        <el-input
          v-model="queryParams.extra4"
          placeholder="请输入扩展字段4"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="扩展字段5" prop="extra5">
        <el-input
          v-model="queryParams.extra5"
          placeholder="请输入扩展字段5"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="扩展字段6" prop="extra6">
        <el-input
          v-model="queryParams.extra6"
          placeholder="请输入扩展字段6"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="扩展字段7" prop="extra7">
        <el-input
          v-model="queryParams.extra7"
          placeholder="请输入扩展字段7"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="扩展字段8" prop="extra8">
        <el-input
          v-model="queryParams.extra8"
          placeholder="请输入扩展字段8"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="扩展字段9" prop="extra9">
        <el-input
          v-model="queryParams.extra9"
          placeholder="请输入扩展字段9"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="扩展字段10" prop="extra10">
        <el-input
          v-model="queryParams.extra10"
          placeholder="请输入扩展字段10"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="防爆合格证号" prop="certificateCode">
        <el-input
          v-model="queryParams.certificateCode"
          placeholder="请输入防爆合格证号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="矿用产品安全标志" prop="safety">
        <el-input
          v-model="queryParams.safety"
          placeholder="请输入矿用产品安全标志"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="单位" prop="unit">
        <el-input
          v-model="queryParams.unit"
          placeholder="请输入单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="数量" prop="countNum">
        <el-input
          v-model="queryParams.countNum"
          placeholder="请输入数量"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="包机人id" prop="userId">
        <el-input
          v-model="queryParams.userId"
          placeholder="请输入包机人id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="包机人姓名" prop="userName">
        <el-input
          v-model="queryParams.userName"
          placeholder="请输入包机人姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="矿编号" prop="mineNo">
        <el-input
          v-model="queryParams.mineNo"
          placeholder="请输入矿编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="组态画面url" prop="configurationUrl">
        <el-input
          v-model="queryParams.configurationUrl"
          placeholder="请输入组态画面url"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="临时导入日期字段" prop="dateCopy">
        <el-input
          v-model="queryParams.dateCopy"
          placeholder="请输入临时导入日期字段"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="是否定位 0否1是" prop="locationFlag">
        <el-input
          v-model="queryParams.locationFlag"
          placeholder="请输入是否定位 0否1是"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['equipmentBook:equipmentBook:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['equipmentBook:equipmentBook:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['equipmentBook:equipmentBook:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['equipmentBook:equipmentBook:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="equipmentBookList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="设备主键" align="center" prop="equipmentId" />
      <el-table-column label="技术特征台账主键" align="center" prop="techFeaturesId" />
      <el-table-column label="设备编码" align="center" prop="equipmentCode" />
      <el-table-column label="设备名称" align="center" prop="equipmentName" />
      <el-table-column label="设备类型字典ID" align="center" prop="equipmentTypeId" />
      <el-table-column label="设备类型字典名称" align="center" prop="equipmentTypeName" />
      <el-table-column label="分类主键" align="center" prop="classifyId" />
      <el-table-column label="分类编码" align="center" prop="classifyCode" />
      <el-table-column label="分类名称" align="center" prop="classifyName" />
      <el-table-column label="设备别名" align="center" prop="equipmentAlias" />
      <el-table-column label="所在系统树名称id" align="center" prop="eqSysId" />
      <el-table-column label="所在系统树名称" align="center" prop="eqSysName" />
      <el-table-column label="设备规格" align="center" prop="specs" />
      <el-table-column label="设备型号" align="center" prop="model" />
      <el-table-column label="是否成套设备(1:是；0:否)；" align="center" prop="setStatus" />
      <el-table-column label="制造厂家" align="center" prop="manufacturer" />
      <el-table-column label="出厂年月" align="center" prop="factDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.factDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="出厂编号" align="center" prop="factCode" />
      <el-table-column label="供应商" align="center" prop="supplier" />
      <el-table-column label="交货日期" align="center" prop="wareAt" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.wareAt, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="投产日期" align="center" prop="putProductAt" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.putProductAt, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="维护单位id" align="center" prop="maintainDeptId" />
      <el-table-column label="维护单位名称" align="center" prop="maintainDeptName" />
      <el-table-column label="保修开始" align="center" prop="guaranteeStart" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.guaranteeStart, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="保修结束" align="center" prop="guaranteeEnd" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.guaranteeEnd, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="使用状态字典ID" align="center" prop="useStatusId" />
      <el-table-column label="使用状态字典名称" align="center" prop="useStatusName" />
      <el-table-column label="设备状态字典id" align="center" prop="equipmentStatusId" />
      <el-table-column label="设备状态字典名称" align="center" prop="equipmentStatusName" />
      <el-table-column label="运行状态字典id" align="center" prop="runStatusId" />
      <el-table-column label="运行状态字典名称" align="center" prop="runStatusName" />
      <el-table-column label="放置地点id" align="center" prop="positionAddressId" />
      <el-table-column label="放置地点" align="center" prop="positionAddress" />
      <el-table-column label="" align="center" prop="manageCode" />
      <el-table-column label="资产编码" align="center" prop="assetCode" />
      <el-table-column label="物资编码" align="center" prop="materialCode" />
      <el-table-column label="是否可用 默认1" align="center" prop="enable" />
      <el-table-column label="创建人" align="center" prop="createByName" />
      <el-table-column label="创建时间" align="center" prop="createAt" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createAt, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="更新人" align="center" prop="updateByName" />
      <el-table-column label="更新时间" align="center" prop="updateAt" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.updateAt, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="排序" align="center" prop="sorting" />
      <el-table-column label="备注说明" align="center" prop="remark" />
      <el-table-column label="版本" align="center" prop="version" />
      <el-table-column label="状态, 默认1(1:正常；2:冻结；98:关闭；99:删除)；" align="center" prop="status" />
      <el-table-column label="参照物" align="center" prop="extra1" />
      <el-table-column label="距离" align="center" prop="extra2" />
      <el-table-column label="扩展字段3" align="center" prop="extra3" />
      <el-table-column label="扩展字段4" align="center" prop="extra4" />
      <el-table-column label="扩展字段5" align="center" prop="extra5" />
      <el-table-column label="扩展字段6" align="center" prop="extra6" />
      <el-table-column label="扩展字段7" align="center" prop="extra7" />
      <el-table-column label="扩展字段8" align="center" prop="extra8" />
      <el-table-column label="扩展字段9" align="center" prop="extra9" />
      <el-table-column label="扩展字段10" align="center" prop="extra10" />
      <el-table-column label="防爆合格证号" align="center" prop="certificateCode" />
      <el-table-column label="矿用产品安全标志" align="center" prop="safety" />
      <el-table-column label="单位" align="center" prop="unit" />
      <el-table-column label="数量" align="center" prop="countNum" />
      <el-table-column label="包机人id" align="center" prop="userId" />
      <el-table-column label="包机人姓名" align="center" prop="userName" />
      <el-table-column label="矿编号" align="center" prop="mineNo" />
      <el-table-column label="组态画面url" align="center" prop="configurationUrl" />
      <el-table-column label="临时导入字段判断" align="center" prop="type" />
      <el-table-column label="临时导入日期字段" align="center" prop="dateCopy" />
      <el-table-column label="是否定位 0否1是" align="center" prop="locationFlag" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['equipmentBook:equipmentBook:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['equipmentBook:equipmentBook:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改设备基础台账对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="技术特征台账主键" prop="techFeaturesId">
          <el-input v-model="form.techFeaturesId" placeholder="请输入技术特征台账主键" />
        </el-form-item>
        <el-form-item label="设备编码" prop="equipmentCode">
          <el-input v-model="form.equipmentCode" placeholder="请输入设备编码" />
        </el-form-item>
        <el-form-item label="设备名称" prop="equipmentName">
          <el-input v-model="form.equipmentName" placeholder="请输入设备名称" />
        </el-form-item>
        <el-form-item label="设备类型字典ID" prop="equipmentTypeId">
          <el-input v-model="form.equipmentTypeId" placeholder="请输入设备类型字典ID" />
        </el-form-item>
        <el-form-item label="设备类型字典名称" prop="equipmentTypeName">
          <el-input v-model="form.equipmentTypeName" placeholder="请输入设备类型字典名称" />
        </el-form-item>
        <el-form-item label="分类主键" prop="classifyId">
          <el-input v-model="form.classifyId" placeholder="请输入分类主键" />
        </el-form-item>
        <el-form-item label="分类编码" prop="classifyCode">
          <el-input v-model="form.classifyCode" placeholder="请输入分类编码" />
        </el-form-item>
        <el-form-item label="分类名称" prop="classifyName">
          <el-input v-model="form.classifyName" placeholder="请输入分类名称" />
        </el-form-item>
        <el-form-item label="设备别名" prop="equipmentAlias">
          <el-input v-model="form.equipmentAlias" placeholder="请输入设备别名" />
        </el-form-item>
        <el-form-item label="所在系统树名称id" prop="eqSysId">
          <el-input v-model="form.eqSysId" placeholder="请输入所在系统树名称id" />
        </el-form-item>
        <el-form-item label="所在系统树名称" prop="eqSysName">
          <el-input v-model="form.eqSysName" placeholder="请输入所在系统树名称" />
        </el-form-item>
        <el-form-item label="设备规格" prop="specs">
          <el-input v-model="form.specs" placeholder="请输入设备规格" />
        </el-form-item>
        <el-form-item label="设备型号" prop="model">
          <el-input v-model="form.model" placeholder="请输入设备型号" />
        </el-form-item>
        <el-form-item label="制造厂家" prop="manufacturer">
          <el-input v-model="form.manufacturer" placeholder="请输入制造厂家" />
        </el-form-item>
        <el-form-item label="出厂年月" prop="factDate">
          <el-date-picker clearable
            v-model="form.factDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择出厂年月">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="出厂编号" prop="factCode">
          <el-input v-model="form.factCode" placeholder="请输入出厂编号" />
        </el-form-item>
        <el-form-item label="供应商" prop="supplier">
          <el-input v-model="form.supplier" placeholder="请输入供应商" />
        </el-form-item>
        <el-form-item label="交货日期" prop="wareAt">
          <el-date-picker clearable
            v-model="form.wareAt"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择交货日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="投产日期" prop="putProductAt">
          <el-date-picker clearable
            v-model="form.putProductAt"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择投产日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="维护单位id" prop="maintainDeptId">
          <el-input v-model="form.maintainDeptId" placeholder="请输入维护单位id" />
        </el-form-item>
        <el-form-item label="维护单位名称" prop="maintainDeptName">
          <el-input v-model="form.maintainDeptName" placeholder="请输入维护单位名称" />
        </el-form-item>
        <el-form-item label="保修开始" prop="guaranteeStart">
          <el-date-picker clearable
            v-model="form.guaranteeStart"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择保修开始">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="保修结束" prop="guaranteeEnd">
          <el-date-picker clearable
            v-model="form.guaranteeEnd"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择保修结束">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="使用状态字典ID" prop="useStatusId">
          <el-input v-model="form.useStatusId" placeholder="请输入使用状态字典ID" />
        </el-form-item>
        <el-form-item label="使用状态字典名称" prop="useStatusName">
          <el-input v-model="form.useStatusName" placeholder="请输入使用状态字典名称" />
        </el-form-item>
        <el-form-item label="设备状态字典id" prop="equipmentStatusId">
          <el-input v-model="form.equipmentStatusId" placeholder="请输入设备状态字典id" />
        </el-form-item>
        <el-form-item label="设备状态字典名称" prop="equipmentStatusName">
          <el-input v-model="form.equipmentStatusName" placeholder="请输入设备状态字典名称" />
        </el-form-item>
        <el-form-item label="运行状态字典id" prop="runStatusId">
          <el-input v-model="form.runStatusId" placeholder="请输入运行状态字典id" />
        </el-form-item>
        <el-form-item label="运行状态字典名称" prop="runStatusName">
          <el-input v-model="form.runStatusName" placeholder="请输入运行状态字典名称" />
        </el-form-item>
        <el-form-item label="放置地点id" prop="positionAddressId">
          <el-input v-model="form.positionAddressId" placeholder="请输入放置地点id" />
        </el-form-item>
        <el-form-item label="放置地点" prop="positionAddress">
          <el-input v-model="form.positionAddress" placeholder="请输入放置地点" />
        </el-form-item>
        <el-form-item label="" prop="manageCode">
          <el-input v-model="form.manageCode" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="资产编码" prop="assetCode">
          <el-input v-model="form.assetCode" placeholder="请输入资产编码" />
        </el-form-item>
        <el-form-item label="物资编码" prop="materialCode">
          <el-input v-model="form.materialCode" placeholder="请输入物资编码" />
        </el-form-item>
        <el-form-item label="是否可用 默认1" prop="enable">
          <el-input v-model="form.enable" placeholder="请输入是否可用 默认1" />
        </el-form-item>
        <el-form-item label="创建人" prop="createByName">
          <el-input v-model="form.createByName" placeholder="请输入创建人" />
        </el-form-item>
        <el-form-item label="创建时间" prop="createAt">
          <el-date-picker clearable
            v-model="form.createAt"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择创建时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="更新人" prop="updateByName">
          <el-input v-model="form.updateByName" placeholder="请输入更新人" />
        </el-form-item>
        <el-form-item label="更新时间" prop="updateAt">
          <el-date-picker clearable
            v-model="form.updateAt"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择更新时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="排序" prop="sorting">
          <el-input v-model="form.sorting" placeholder="请输入排序" />
        </el-form-item>
        <el-form-item label="备注说明" prop="remark">
          <el-input v-model="form.remark" placeholder="请输入备注说明" />
        </el-form-item>
        <el-form-item label="版本" prop="version">
          <el-input v-model="form.version" placeholder="请输入版本" />
        </el-form-item>
        <el-form-item label="参照物" prop="extra1">
          <el-input v-model="form.extra1" placeholder="请输入参照物" />
        </el-form-item>
        <el-form-item label="距离" prop="extra2">
          <el-input v-model="form.extra2" placeholder="请输入距离" />
        </el-form-item>
        <el-form-item label="扩展字段3" prop="extra3">
          <el-input v-model="form.extra3" placeholder="请输入扩展字段3" />
        </el-form-item>
        <el-form-item label="扩展字段4" prop="extra4">
          <el-input v-model="form.extra4" placeholder="请输入扩展字段4" />
        </el-form-item>
        <el-form-item label="扩展字段5" prop="extra5">
          <el-input v-model="form.extra5" placeholder="请输入扩展字段5" />
        </el-form-item>
        <el-form-item label="扩展字段6" prop="extra6">
          <el-input v-model="form.extra6" placeholder="请输入扩展字段6" />
        </el-form-item>
        <el-form-item label="扩展字段7" prop="extra7">
          <el-input v-model="form.extra7" placeholder="请输入扩展字段7" />
        </el-form-item>
        <el-form-item label="扩展字段8" prop="extra8">
          <el-input v-model="form.extra8" placeholder="请输入扩展字段8" />
        </el-form-item>
        <el-form-item label="扩展字段9" prop="extra9">
          <el-input v-model="form.extra9" placeholder="请输入扩展字段9" />
        </el-form-item>
        <el-form-item label="扩展字段10" prop="extra10">
          <el-input v-model="form.extra10" placeholder="请输入扩展字段10" />
        </el-form-item>
        <el-form-item label="防爆合格证号" prop="certificateCode">
          <el-input v-model="form.certificateCode" placeholder="请输入防爆合格证号" />
        </el-form-item>
        <el-form-item label="矿用产品安全标志" prop="safety">
          <el-input v-model="form.safety" placeholder="请输入矿用产品安全标志" />
        </el-form-item>
        <el-form-item label="单位" prop="unit">
          <el-input v-model="form.unit" placeholder="请输入单位" />
        </el-form-item>
        <el-form-item label="数量" prop="countNum">
          <el-input v-model="form.countNum" placeholder="请输入数量" />
        </el-form-item>
        <el-form-item label="包机人id" prop="userId">
          <el-input v-model="form.userId" placeholder="请输入包机人id" />
        </el-form-item>
        <el-form-item label="包机人姓名" prop="userName">
          <el-input v-model="form.userName" placeholder="请输入包机人姓名" />
        </el-form-item>
        <el-form-item label="矿编号" prop="mineNo">
          <el-input v-model="form.mineNo" placeholder="请输入矿编号" />
        </el-form-item>
        <el-form-item label="组态画面url" prop="configurationUrl">
          <el-input v-model="form.configurationUrl" placeholder="请输入组态画面url" />
        </el-form-item>
        <el-form-item label="临时导入日期字段" prop="dateCopy">
          <el-input v-model="form.dateCopy" placeholder="请输入临时导入日期字段" />
        </el-form-item>
        <el-form-item label="是否定位 0否1是" prop="locationFlag">
          <el-input v-model="form.locationFlag" placeholder="请输入是否定位 0否1是" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listEquipmentBook, getEquipmentBook, delEquipmentBook, addEquipmentBook, updateEquipmentBook } from "@/api/equipmentBook/equipmentBook";

export default {
  name: "EquipmentBook",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 设备基础台账表格数据
      equipmentBookList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        techFeaturesId: null,
        equipmentCode: null,
        equipmentName: null,
        equipmentTypeId: null,
        equipmentTypeName: null,
        classifyId: null,
        classifyCode: null,
        classifyName: null,
        equipmentAlias: null,
        eqSysId: null,
        eqSysName: null,
        specs: null,
        model: null,
        setStatus: null,
        manufacturer: null,
        factDate: null,
        factCode: null,
        supplier: null,
        wareAt: null,
        putProductAt: null,
        maintainDeptId: null,
        maintainDeptName: null,
        guaranteeStart: null,
        guaranteeEnd: null,
        useStatusId: null,
        useStatusName: null,
        equipmentStatusId: null,
        equipmentStatusName: null,
        runStatusId: null,
        runStatusName: null,
        positionAddressId: null,
        positionAddress: null,
        manageCode: null,
        assetCode: null,
        materialCode: null,
        enable: null,
        createByName: null,
        createAt: null,
        updateByName: null,
        updateAt: null,
        sorting: null,
        version: null,
        status: null,
        extra1: null,
        extra2: null,
        extra3: null,
        extra4: null,
        extra5: null,
        extra6: null,
        extra7: null,
        extra8: null,
        extra9: null,
        extra10: null,
        certificateCode: null,
        safety: null,
        unit: null,
        countNum: null,
        userId: null,
        userName: null,
        mineNo: null,
        configurationUrl: null,
        type: null,
        dateCopy: null,
        locationFlag: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询设备基础台账列表 */
    getList() {
      this.loading = true;
      listEquipmentBook(this.queryParams).then(response => {
        this.equipmentBookList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        equipmentId: null,
        techFeaturesId: null,
        equipmentCode: null,
        equipmentName: null,
        equipmentTypeId: null,
        equipmentTypeName: null,
        classifyId: null,
        classifyCode: null,
        classifyName: null,
        equipmentAlias: null,
        eqSysId: null,
        eqSysName: null,
        specs: null,
        model: null,
        setStatus: null,
        manufacturer: null,
        factDate: null,
        factCode: null,
        supplier: null,
        wareAt: null,
        putProductAt: null,
        maintainDeptId: null,
        maintainDeptName: null,
        guaranteeStart: null,
        guaranteeEnd: null,
        useStatusId: null,
        useStatusName: null,
        equipmentStatusId: null,
        equipmentStatusName: null,
        runStatusId: null,
        runStatusName: null,
        positionAddressId: null,
        positionAddress: null,
        manageCode: null,
        assetCode: null,
        materialCode: null,
        enable: null,
        createBy: null,
        createByName: null,
        createAt: null,
        updateBy: null,
        updateByName: null,
        updateAt: null,
        sorting: null,
        remark: null,
        version: null,
        status: null,
        extra1: null,
        extra2: null,
        extra3: null,
        extra4: null,
        extra5: null,
        extra6: null,
        extra7: null,
        extra8: null,
        extra9: null,
        extra10: null,
        certificateCode: null,
        safety: null,
        unit: null,
        countNum: null,
        userId: null,
        userName: null,
        mineNo: null,
        configurationUrl: null,
        type: null,
        dateCopy: null,
        locationFlag: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.equipmentId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加设备基础台账";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const equipmentId = row.equipmentId || this.ids
      getEquipmentBook(equipmentId).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改设备基础台账";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.equipmentId != null) {
            updateEquipmentBook(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addEquipmentBook(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const equipmentIds = row.equipmentId || this.ids;
      this.$modal.confirm('是否确认删除设备基础台账编号为"' + equipmentIds + '"的数据项？').then(function() {
        return delEquipmentBook(equipmentIds);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('equipmentBook/equipmentBook/export', {
        ...this.queryParams
      }, `equipmentBook_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
